/**
 * @Date: Mar 4, 2010 3:31:39 PM
 */
package com.philip.journal.core.service;

import java.util.Map;

import org.apache.log4j.Logger;

import com.philip.core.BusinessServiceProxy;
import com.philip.journal.core.dao.DAOFacade;

/**
 * @author cry30
 */
public abstract class BaseService { // NOPMD by r39 on 3/30/11 12:11 PM


    /** Sub class reusable logger instance. */
    private final Logger logger = Logger.getLogger(getClass()); // NOPMD by r39 on 3/30/11 12:09 PM

    /** Subclass reusable DAO Facade. */
    private transient DAOFacade daoFacade;

    /**
     * IOC accessor for DAO Facade.
     *
     * @param pDaoFacade IOC injected DAO Facade
     */
    public void setDaoFacade(final DAOFacade pDaoFacade) {
        this.daoFacade = pDaoFacade;
    }

    /**
     * Convenience method to get the Service Facade.
     *
     * @param session the current server side session.
     * @return the Single instance Service Facade.
     */
    public ServiceFacade getFacade(final Map<String, Object> session) {
        return (ServiceFacade) session.get(BusinessServiceProxy.SERVICE_FACADE);
    }

    /**
     * @return the logger
     */
    public Logger getLogger() {
        return logger;
    }

    /**
     * @return the daoFacade
     */
    public DAOFacade getDaoFacade() {
        return daoFacade;
    }
}
